package com.wjf.birdfish.util;

/**
* Write by gagaghost
* 
* 将字符串转化成gb2312编码的类
* 
*/

public class Chinese {

	public static String toChinese(String strvalue) {

		try {
			if (strvalue == null || strvalue.equals("null"))
				return "";
			else {
				strvalue =
					new String(strvalue.getBytes("ISO-8859-1"), "gb2312");
				String str = strvalue.replace((char) 39, (char) 34);
				return str;
			}
		} catch (Exception e) {
			return "";
		}
	}
	/**
    * 将strvalue转化成gb2312编码
    *
    */ 
	public static String toChinese8859(String strvalue) {

		try {
			if (strvalue == null || strvalue.equals("null"))
				return "";
			else {
				strvalue =
					new String(strvalue.getBytes("gb2312"), "ISO-8859-1");
				String str = strvalue.replace((char) 39, (char) 34);
				return str;
			}
		} catch (Exception e) {
			return "";
		}
	}
   public static void main(String[] args){
	   Chinese.toChinese("");
   }
}

